<template>
  <div v-if="items.length" class="pendbox">
    <div class="header">
      <div class="title">热卖榜</div>
    </div>
    <div class="recommendbox">
      <!--eslint-disable-next-line-->
      <div v-for="(item,index) in items" class="item" :key="index" @click="onClick(item)">
        <chimage class="img" :src="item.adv_img"></chimage>
        <div class="title">{{item.goods_name}}</div>
        <div class="desc">{{item.subtitle}}</div>
        <div class="qt">
          <div>
            <div>
              ￥
              <span class="price">{{item.internal_price}}</span>
            </div>
            <div>
              价格
              <span class="d-price">{{item.reference_price}}</span>
            </div>
          </div>
          <!-- <div class="bag bag-ticket">300元券</div>
          <div class="bag bag-active">家装节</div> -->
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'mallRecommend',
    props: {
      items: Array
    },
    methods: {
      onClick (item) {
        this.$router.push({ name: 'mallInfo', params: { id: item.goods_sku } })
      }
    }
  }
</script>

<style lang="less" scoped>
  .pendbox {
    .header {
      display: flex;
      justify-content: space-between;
      align-items: center;

      .title {
        font-size: 15px;
        color: #351009;
        line-height: 24px;
      }

      .subtitle {
        font-size: 12px;
        color: #848484;
      }

      .more {
        color: #a8a8a8;
        font-size: 12px;
      }
    }
  }

  .recommendbox {
    .item {
      background-color: #fff;
      padding: 12px;
      box-sizing: border-box;

      .img {
        display: block;
        height: 330px;
        width: 100%;
        background-color: #ffffff;
        background-position: center;
        background-size: contain;
      }

      .title {
        font-size: 12px;
        line-height: 17px;
        margin-top: 20px;
        color: #737373;
        font-weight: 600;
      }

      .desc {
        font-size: 10px;
        line-height: 15px;
        color: #737373;
      }

      .qt {
        display: flex;
        margin-top: 12px;
        color: #575757;
        font-size: 10px;
        line-height: 20px;

        .price {
          font-size: 14px;
        }
      }

      .bag {
        padding-left: 6px;
        padding-right: 6px;
        margin-left: 24px;
        font-size: 10px;
        height: 12px;
        line-height: 14px;
      }

      .bag-ticket {
        background-color: #ff230c;
        color: #fff;
      }

      .bag-active {
        background-color: #920882;
        color: #fff;
      }

      .item + .item {
        margin-top: 12px;
      }
    }
  }

  .price {
    color: #fd0002;
  }

  .d-price {
    color: #8a8687;
    text-decoration: line-through;
  }

  .streamer {
    height: 163px;
    width: 100%;
    display: block;
    background-color: #fff;
  }
</style>
